<template>
  <div style="padding: 10px;">
    <!--<div class="top">学费剩余课时为（{{ num }}）发送</div>-->
    <div class="sae-textarea">
      <van-field type="textarea" rows="5" autosize v-model="message">
        <div class="sae-label" slot="label">发送通知</div>
      </van-field>
    </div>
    <div class="btn">
      <van-button type="info" size="large" @click="toSubmit">保存</van-button>
    </div>
  </div>
</template>

<script>
import api from '@/api'
export default {
  name: 'urge',
  data () {
    return {
      message: '温馨提示：您的剩余课时不多了，请核对并及时缴费！',
      num: ''
    }
  },
  methods: {
    toSubmit () {
      let params = {
        student_id: this.$route.query.id,
        teacher_id: JSON.parse(sessionStorage.getItem('user')).id,
        content: this.message
      }
      api.teacherUrge({
        params,
        callback: res => {
          if (res.data.error_code === 0) {
            this.$toast({
              message: '发送成功',
              duration: 1000,
              onClose: () => {
                this.$router.go(-1)
              }
            })
          }
        }
      })
    }
  },
  created () {
    this.num = this.$route.query.num
  }
}
</script>

<style scoped>
  .top{
    padding: 24px 0 16px 0;
    border-bottom: 1px solid #707070;
    font-size:18px;
    font-family:PingFang SC;
    font-weight:bold;
  }
  .sae-label{
    font-size:18px;
    font-family:PingFang SC;
    font-weight:bold;
    padding: 8px 0;
  }
  .van-cell{
    padding: 10px 0 0 0;
  }
  .btn{
    margin-top: 100px;
  }
</style>
